﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="BrowseTests.aspx.cs" Inherits="JustTest.Admin.BrowseTests" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <label for="DropDownListTestStatus">Choose status type: </label>
    <asp:DropDownList ID="DropDownListTestStatus" runat="server" AutoPostBack="true"
        OnSelectedIndexChanged="DropDownListTestStatus_SelectedIndexChanged">
        <asp:ListItem Text="Unaproved" Value="1" Selected="True"/>
        <asp:ListItem Text="Active" Value="2"/>
        <asp:ListItem Text="Suspended" Value="3"/>
    </asp:DropDownList>

    <asp:GridView ID="GridViewTests" runat="server" ItemType="JustTest.Models.Test"
        AutoGenerateColumns="false" AutoGenerateEditButton="true"
        DataKeyNames="Id"
        SelectMethod="GridViewTests_GetData"
        UpdateMethod="GridViewTests_UpdateItem"
        AllowPaging="true" PageSize="5"
        AllowSorting="true"
        CssClass="table table-hover table-striped">
        <Columns>
            <asp:DynamicField DataField="Title" />
            <asp:TemplateField HeaderText="Actions">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLinkEditTest" Text="Edit content" runat="server"
                        NavigateUrl= '<%#: "~/Author/AuthorEditTest?id=" + Item.Id %>'
                        CssClass="btn btn-info" />
                    <asp:Button ID="ButtonToggleTestStatus" Text="Aprove" runat="server"
                        OnClick="ButtonToggleTestStatus_Click" CommandArgument="<%# Item.Id %>"
                        CssClass="btn btn-info"/>
                    <asp:Button ID="ButtonRejectTest" Text="Reject" runat="server" 
                        OnClick="ButtonRejectTest_Click" CommandArgument="<%# Item.Id %>"
                        CssClass="btn btn-info"/>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <div>No <%#: this.DropDownListTestStatus.SelectedItem.Text %> tests</div>
        </EmptyDataTemplate>
    </asp:GridView>
    
</asp:Content>
